package com.gome.axwl.aoc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gome.axwl.aoc.dao.ContractTemplateDao;
import com.gome.axwl.aoc.entity.po.ContractPo;
import com.gome.axwl.aoc.entity.po.ContractTemplatePo;
import com.gome.axwl.aoc.service.ContractTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by wanglongyu on 2018/7/16.
 */
@Service
public class ContractTemplateServiceImpl implements ContractTemplateService{
    @Autowired
    private ContractTemplateDao contractTemplateDao;

    @Override
    public PageInfo<ContractTemplatePo> queryTemplate(String templateName,Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum==null?1:pageNum,pageSize==null?10:pageSize);
        List<ContractTemplatePo> contractTemplatePos = contractTemplateDao.queryTemplate(templateName);
        PageInfo<ContractTemplatePo> pageInfo=new PageInfo<>(contractTemplatePos);
        return pageInfo;
    }

    @Override
    public Integer update(String templateNo, String templateName, String property, Integer signWay,Date modifyTime) {
        return contractTemplateDao.update(templateNo, templateName, property, signWay, modifyTime);
    }

    @Override
    public int delete(String templateNo,Date modifyTime) {
        return contractTemplateDao.delete(templateNo,modifyTime);
    }

    @Override
    public List<ContractTemplatePo> queryAll() {
        return contractTemplateDao.queryAll();
    }

    @Override
    public int addTemplate(ContractTemplatePo record) {
        return contractTemplateDao.addTemplate(record);
    }

    @Override
    public ContractTemplatePo selectByApplyInfoId(Integer applyInfoId) {
        return contractTemplateDao.selectByApplyInfoId(applyInfoId);
    }
}
